package queue;

import java.util.ArrayDeque;

public class b {
    public static void main(String[] args) {
        ArrayDeque<String> myQueue = new ArrayDeque<String>(4);
        System.out.println("获得头元素："+myQueue.peek());
        System.out.println("插入元素：" +myQueue.offer("a"));
        System.out.println("插入元素：" +myQueue.offer("b"));
        System.out.println("插入元素：" +myQueue.offer("c"));
        System.out.println("插入元素：" +myQueue.offer("d"));
        System.out.println("插入元素：" +myQueue.offer("e"));
        System.out.println("插入元素：" +myQueue.offer("f"));
        System.out.println("插入元素：" +myQueue.offer("g"));
        System.out.println("插入元素：" +myQueue.offer("f"));
        System.out.println("插入元素：" +myQueue.offer("f"));
        System.out.println("插入元素：" +myQueue.offer("f"));
        System.out.println("插入元素：" +myQueue.offer("f"));
        System.out.println("插入元素：" +myQueue.offer("f"));
        System.out.println("获得头元素："+myQueue.peek());

        System.out.println("移除元素：" + myQueue.poll());
        System.out.println("移除元素：" + myQueue.poll());
        System.out.println("移除元素：" + myQueue.poll());
        System.out.println("移除元素：" + myQueue.poll());
        System.out.println("移除元素：" + myQueue.poll());
        System.out.println("获得头元素："+myQueue.peek());
    }
}
